<template>
<div class="goods-item">
  <div class="goods-img">
    <img :src="item.img" alt="">
  </div>
  <div>
    <p class="title">
      {{ item.title }}
    </p>
  </div>
  <div class="info">
    <p class="price">
      ￥{{item.price}}
    </p>
    <p class="sale">
      销量20万+
    </p>
  </div>
</div>
</template>

<script setup>

const goods = defineProps(['item']);
const togood=(item)=>{
  router.push({path:'/productDetail',query:{"product":JSON.stringify(item)}})
}

</script>

<style scoped>
.goods-item {
  display: flex;
  flex-direction: column;
  width: 200px;
  height: 300px;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}
.goods-img {
  width: 100%;
  height: 200px;
  overflow: hidden;
}
.goods-item:hover {
  transform: translateY(-5px);
  background-color: seashell;
  border: 1px solid rgba(255, 15, 35);
}
.title {
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 限制两行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
}

.price{
  color: red;
  font-size: 16px;
}
.sale{
  color: #999;
  font-size: 12px;
}
.info{
  display: flex;
  align-items: center;
}
</style>